import guitar.Guitar;
import guitar.GuitarSpec;
import inventory.Inventory;
import java.util.Iterator;
import java.util.List;
import params.*;

public class FindGuitarTester {
    public static void main(String[] args) {
        Inventory inventory = new Inventory();
        initializeInventory(inventory);

        GuitarSpec search = new GuitarSpec(Builder.FENDER, "Stratocastor", Type.ELECTRIC, 6, Wood.ALDER, Wood.ALDER);
        List matchingGuitars = inventory.search(search);
        if (!matchingGuitars.isEmpty() ) {
            System.out.println("Proponujemy gitary:");
            for (Iterator i = matchingGuitars.iterator(); i.hasNext(); ) {
                Guitar g = (Guitar)i.next();
                GuitarSpec spec = g.getSpec();
                System.out.println( spec.getBuilder() + " model " + spec.getModel() + " cena " + g.getPrice() );
            }
        }
        else {
            System.out.println("Brak gitar spełniających poadane kryteria.");
        }
    }

    private static void initializeInventory(Inventory inventory) {
        inventory.addGuitar("11277", 3999.95,
                new GuitarSpec(Builder.COLLINGS, "CJ", Type.ACOUSTIC, 6,
                Wood.INDIAN_ROSEWOOD, Wood.SITKA));
        inventory.addGuitar("V95693", 1499.95,
                new GuitarSpec(Builder.FENDER, "Stratocastor", Type.ELECTRIC, 6,
                Wood.ALDER, Wood.ALDER));
        inventory.addGuitar("V9512", 1549.95,
                new GuitarSpec(Builder.FENDER, "Stratocastor", Type.ELECTRIC, 6,
                Wood.ALDER, Wood.ALDER));
        inventory.addGuitar("122784", 5495.95,
                new GuitarSpec(Builder.MARTIN, "D-18", Type.ACOUSTIC, 6,
                Wood.MAHOGANY, Wood.OAK));
        inventory.addGuitar("76531", 6295.95,
                new GuitarSpec(Builder.MARTIN, "OM-28", Type.ACOUSTIC, 6,
                Wood.BRAZILIAN_ROSEWOOD, Wood.OAK));
        inventory.addGuitar("70108276", 2295.95,
                new GuitarSpec(Builder.GIBSON, "Les Paul", Type.ELECTRIC, 6,
                Wood.MAPLE, Wood.MAPLE));
        inventory.addGuitar("82765501", 1890.95,
                new GuitarSpec(Builder.GIBSON, "SG '61 Reissue", Type.ELECTRIC, 6,
                Wood.MAHOGANY, Wood.MAHOGANY));
        inventory.addGuitar("77023", 6275.95,
                new GuitarSpec(Builder.MARTIN, "D-28", Type.ACOUSTIC, 6,
                Wood.BRAZILIAN_ROSEWOOD, Wood.OAK));
        inventory.addGuitar("1092", 12995.95,
                new GuitarSpec(Builder.OLSON, "SJ", Type.ACOUSTIC, 12,
                Wood.INDIAN_ROSEWOOD, Wood.CEDAR));
        inventory.addGuitar("566-62", 8999.95,
                new GuitarSpec(Builder.RYAN, "Cathedral", Type.ACOUSTIC, 12,
                Wood.EBONY, Wood.CEDAR));
        inventory.addGuitar("6 29584", 2100.95,
                new GuitarSpec(Builder.PRS, "Dave Navarro Signature", Type.ELECTRIC,
                6, Wood.MAHOGANY, Wood.MAPLE));
    }
}